// Description  :
// Author       : MMingzhao
// Date         : 2020-01-16 11:22

// Package service
package service

import (
	"go-admin-template/model"
	"go-admin-template/router/entity"
)

//FindByUsername 查询用户名称是否被占用
func FindByUsername(username string) (bool, model.User) {

	isExist, user := model.QueryUserByUsername(username)

	return isExist, user
}

//SaveUser 保存用户信息
func SaveUser(user entity.User) {

	model.InsertUser(model.User{
		Username: user.Username,
		Mobile:   user.Mobile,
		Email:    user.Email,
		Password: user.Password,
	})

}

//UserList 查询所有用户信息
func UserList() []model.User {
	return model.QueryUsers()
}
